/** 切换缩放 */
const actionChangeScale = (PDFViewerApplication, scaleType) => {
    PDFViewerApplication?.eventBus?.dispatch("scalechanged", {
        value: scaleType,
    });
};



setTimeout(() => {
    // 一、获取 pdf 实例
    const { PDFViewerApplication, PDFViewerApplicationOptions } = window;
    // console.log(11, PDFViewerApplication)
    // console.log(22, PDFViewerApplicationOptions)

    // 二、监听加载状态
    const actionListenInit = (app) => {
        app.initializedPromise.then(() => {
            console.log("实例加载完成");
        });

        // app.eventBus.on("documentloaded", (e) => {
        //     console.log("pdf 内容加载完成", e);
        // });

        app.eventBus.on("pagerendered", (e) => {
            console.log(`第 ${e.pageNumber} 渲染完成`, e);
        });
    };
    actionListenInit(PDFViewerApplication);


    // 三、滚动模式：水平
    // switch (layout) {
    //   case "SinglePage":
    //     scrollMode = ScrollMode.PAGE;
    //     break;
    //   case "OneColumn":
    //     break;
    //   case "TwoPageLeft":
    //     scrollMode = ScrollMode.PAGE;
    //   case "TwoColumnLeft":
    //     spreadMode = SpreadMode.ODD;
    //     break;
    //   case "TwoPageRight":
    //     scrollMode = ScrollMode.PAGE;
    //   case "TwoColumnRight":
    //     spreadMode = SpreadMode.EVEN;
    //     break;
    // }
    // const ScrollMode = {
    //   UNKNOWN: -1,
    //   VERTICAL: 0,
    //   HORIZONTAL: 1,
    //   WRAPPED: 2,
    //   PAGE: 3
    // };
    // PDFViewerApplication?.eventBus?.dispatch("scrollmodechanged", {
    //     // type: paramType,
    //     mode: 1,
    // });

    actionChangeScale(PDFViewerApplication, 0.55);
}, 500)